﻿
namespace Framework
{
    public class LogHelper
    {
        private static string m_LoggerName = "Logger";
        private static log4net.ILog _logger = null;
        private static log4net.ILog m_logger
        {
            get
            {
                if (_logger == null)
                    lock (objLock)
                        if (_logger == null)
                            _logger = log4net.LogManager.GetLogger(LogHelper.m_LoggerName);
                return _logger;
            }
        }
        private static object objLock = new object();
        public static void Debug(object message)
        {
            if (message == null) return;
            if (!m_logger.IsDebugEnabled) return;
            m_logger.Debug(message);

        }

        public static void DebugFormat(string format, params object[] args)
        {
            if (format == null) return;
            if (!m_logger.IsDebugEnabled) return;
            m_logger.DebugFormat(format, args);
        }

        public static void Error(object message)
        {
            if (message == null) return;
            if (!m_logger.IsErrorEnabled) return;
            m_logger.Error(message);
        }

        public static void ErrorFormat(string format, params object[] arg0)
        {
            if (format == null) return;
            if (!m_logger.IsErrorEnabled) return;
            m_logger.ErrorFormat(format, arg0);
        }

        public static void Fatal(object message)
        {
            if (message == null) return;
            if (!m_logger.IsFatalEnabled) return;
            m_logger.Fatal(message);
        }

        public static void FatalFormat(string format, params object[] arg0)
        {
            if (format == null) return;
            if (!m_logger.IsFatalEnabled) return;
            m_logger.FatalFormat(format, arg0);
        }

        public static void Info(object message)
        {
            if (message == null) return;
            if (!m_logger.IsInfoEnabled) return;
            m_logger.Info(message);
        }

        public static void InfoFormat(string format, params object[] arg0)
        {
            if (format == null) return;
            if (!m_logger.IsInfoEnabled) return;
            m_logger.InfoFormat(format, arg0);
        }

        public static void Warn(object message)
        {
            if (message == null) return;
            if (!m_logger.IsWarnEnabled) return;
            m_logger.Warn(message);
        }

        public static void WarnFormat(string format, params object[] arg0)
        {
            if (format == null) return;
            if (!m_logger.IsWarnEnabled) return;
            m_logger.WarnFormat(format, arg0);
        }
    }
}
